home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Wipes ƒ / Caste wipe left.c < prev    next >
Text File  |  1994-04-15  |  2KB  |  70 lines

  1. /**********************************************************************\
  2.  
  3. File:        Caste wipe left.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define CorrectTime 1
  28. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  29. #define theWindowWidth (boundsRect.right-boundsRect.left)
  30.  
  31. pascal short CasteWipeRL(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  32.  
  33. /* This takes a strip (starting with the leftmost strip, moving right) and
  34.    copies it into all the strips starting at the right and moving left until
  35.    its in the right place. */
  36.    
  37. pascal short CasteWipeRL(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  38. {
  39.     int                srcx, barpos;
  40.     Rect            src, dest;
  41.     Boolean            everyOther;
  42.     int                gap;
  43.     
  44.     gap=theWindowWidth/50;
  45.     everyOther=FALSE;
  46.     src.top = boundsRect.top;
  47.     src.bottom = boundsRect.bottom;
  48.     
  49.     for(srcx = boundsRect.left; srcx < boundsRect.right; srcx += gap)
  50.     {
  51.         for(barpos = boundsRect.left; barpos + gap < boundsRect.right; barpos += gap);
  52.         for(; barpos >= srcx; barpos -= gap)
  53.         {
  54.             StartTiming();
  55.             src.left = srcx;
  56.             src.right = srcx + gap;
  57.             dest = src;
  58.             dest.left = barpos;
  59.             dest.right = barpos + gap;
  60.             CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  61.                     &src, &dest, 0, 0L);
  62.             if (everyOther)                        /* really, we need time */
  63.                 TimeCorrection(CorrectTime);       /* correction 0.5, but  */
  64.             everyOther=!everyOther;                /* this will do (gag)   */
  65.         }
  66.     }
  67.     
  68.     return 0;
  69. }
  70.